package day09_charset_io.com.itheima.d1_charset;

import java.io.UnsupportedEncodingException;
import java.util.Arrays;

public class Test1 {
    public static void main(String[] args) throws UnsupportedEncodingException {
        String info = "abc我在";
        byte[] bytes = info.getBytes();
        System.out.println("Arrays.toString( bytes) = " + Arrays.toString(bytes));

        byte[] bytes1 = info.getBytes("GBK");
        System.out.println("Arrays.toString( bytes1) = " + Arrays.toString(bytes1));

        String rs1 = new String(bytes);
        System.out.println("rs1 = " + rs1);

        String rs2 = new String(bytes1);
        System.out.println("rs2 = " + rs2);

        String rs3 = new String(bytes1, "GBK");
        System.out.println("rs3 = " + rs3);

        String talk = "我正在学习java";
        byte[] bytes3 = talk.getBytes();
        System.out.println("Arrays.toString(bytes3) = " + Arrays.toString(bytes3));
        String talk1 = new String(bytes3);
        System.out.println("talk1 = " + talk1);
    }
}
